package cdc.okhttp;

import okhttp3.Headers;
import okhttp3.Request;
import okhttp3.Response;


public class Aid {
	public static void headers(Response response) {
		url(response.request());
		int code=response.code();
		System.out.println("======响应码======");
		System.out.println(code);
		Headers responseHeaders = response.headers();
		System.out.println("======响应头======");
        for (int i = 0, size = responseHeaders.size(); i < size; i++) {
          System.out.println(responseHeaders.name(i) + ": " + responseHeaders.value(i));
        }
        System.out.println("======响应内容======");
	}
	
	public static void url(Request request) {
		System.out.println("======请求路径======");
		String path=request.url().toString();
		System.out.println(path);
		System.out.println("======请求方法======");
		String method=request.method();
		System.out.println(method);
		Headers requestHeaders =request.headers();
		System.out.println("======请求头======");
        for (int i = 0, size = requestHeaders.size(); i < size; i++) {
          System.out.println(requestHeaders.name(i) + ": " + requestHeaders.value(i));
        }
	}
	
	

}
